* @subpackage SpecialPage
*/
class NewPagesPage extends QueryPage {
+
var $namespace;
+ var $username = '';
- function NewPagesPage( $namespace = NS_MAIN ) {
+ function NewPagesPage( $namespace = NS_MAIN, $username = '' ) {
$this->namespace = $namespace;
+ $this->username = $username;
}
function getName() {
return false;
}
+ function makeUserWhere( &$dbo ) {
+ return $this->username ? ' AND rc_user_text = ' . $dbo->addQuotes( $this->username ) : '';
+ }
+
function getSQL() {
global $wgUser, $wgUseRCPatrol;
$usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
$dbr =& wfGetDB( DB_SLAVE );
extract( $dbr->tableNames( 'recentchanges', 'page', 'text' ) );
+ $uwhere = $this->makeUserWhere( $dbr );
+
# FIXME: text will break with compression
return
"SELECT 'Newpages' as type,
page_latest as rev_id
FROM $recentchanges,$page
WHERE rc_cur_id=page_id AND rc_new=1
- AND rc_namespace=" . $this->namespace . " AND page_is_redirect=0";
+ AND rc_namespace=" . $this->namespace . " AND page_is_redirect=0
+ {$uwhere}";
}
function preprocessResults( &$dbo, &$res ) {
}
/**
- * Show a namespace selection form for filtering
+ * Show a form for filtering namespace and username
*
* @return string
*/
function getPageHeader() {
- $thisTitle = Title::makeTitle( NS_SPECIAL, $this->getName() );
- $form = wfOpenElement( 'form', array(
- 'method' => 'post',
- 'action' => $thisTitle->getLocalUrl() ) );
- $form .= wfElement( 'label', array( 'for' => 'namespace' ),
- wfMsg( 'namespace' ) ) . ' ';
- $form .= HtmlNamespaceSelector( $this->namespace );
- # Preserve the offset and limit
- $form .= wfElement( 'input', array(
- 'type' => 'hidden',
- 'name' => 'offset',
- 'value' => $this->offset ) );
- $form .= wfElement( 'input', array(
- 'type' => 'hidden',
- 'name' => 'limit',
- 'value' => $this->limit ) );
- $form .= wfElement( 'input', array(
- 'type' => 'submit',
- 'name' => 'submit',
- 'id' => 'submit',
- 'value' => wfMsg( 'allpagessubmit' ) ) );
- $form .= wfCloseElement( 'form' );
- return( $form );
+ $self = Title::makeTitle( NS_SPECIAL, $this->getName() );
+ $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
+ $form .= '<table><tr><td align="right">' . wfMsgHtml( 'namespace' ) . '</td>';
+ $form .= '<td>' . HtmlNamespaceSelector( $this->namespace ) . '</td><tr>';
+ $form .= '<tr><td align="right">' . wfMsgHtml( 'newpages-username' ) . '</td>';
+ $form .= '<td>' . wfInput( 'username', 30, $this->username ) . '</td></tr>';
+ $form .= '<tr><td></td><td>' . wfSubmitButton( wfMsg( 'allpagessubmit' ) ) . '</td></tr></table>';
+ $form .= wfHidden( 'offset', $this->offset ) . wfHidden( 'limit', $this->limit ) . '</form>';
+ return $form;
}
/**
* @return array
*/
function linkParameters() {
- return( array( 'namespace' => $this->namespace ) );
+ return( array( 'namespace' => $this->namespace, 'username' => $this->username ) );
}
}
list( $limit, $offset ) = wfCheckLimits();
$namespace = NS_MAIN;
+ $username = '';
if ( $par ) {
$bits = preg_split( '/\s*,\s*/', trim( $par ) );
} else {
if( $ns = $wgRequest->getInt( 'namespace', 0 ) )
$namespace = $ns;
+ if( $un = $wgRequest->getText( 'username' ) )
+ $username = $un;
}
if ( ! isset( $shownavigation ) )
$shownavigation = ! $specialPage->including();
- $npp = new NewPagesPage( $namespace );
+ $npp = new NewPagesPage( $namespace, $username );
if ( ! $npp->doFeed( $wgRequest->getVal( 'feed' ), $limit ) )
$npp->doQuery( $offset, $limit, $shownavigation );
echo "Done. Please run maintenance/refreshLinks.php for a more thorough templatelinks update.\n";
}
+# July 2006
+# Add ( rc_namespace, rc_user_text ) index [R. Church]
+function do_rc_indices_update() {
+ global $wgDatabase;
+ echo( "Checking for additional recent changes indices...\n" );
+ # See if we can find the index we want
+ $info = $wgDatabase->indexInfo( 'recentchanges', 'rc_ns_usertext', __METHOD__ );
+ if( !$info ) {
+ # None, so create
+ echo( "...index on ( rc_namespace, rc_user_text ) not found; creating\n" );
+ dbsource( archive( 'patch-recentchanges-utindex.sql' ) );
+ } else {
+ # Index seems to exist
+ echo( "...seems to be ok\n" );
+ }
+}
+
function do_all_updates( $doShared = false ) {
global $wgNewTables, $wgNewFields, $wgRenamedTables, $wgSharedDB, $wgDatabase;
do_logging_timestamp_index(); flush();
do_page_random_update(); flush();
+
+ do_rc_indices_update(); flush();
initialiseMessages(); flush();
}